package com.hg.library.ui.gallery.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;

import java.util.ArrayList;

/**
 * Created by wangjianqiang on 2016/4/22.
 */
public class LaberAdapter extends BaseAdapter {
    private Context context;
    private ArrayList<Integer> labels = new ArrayList<>();

    public LaberAdapter(Context context) {
        this.context = context;
    }
    public void setLabels(ArrayList<Integer> labels){
        this.labels = labels;
    }
    @Override
    public int getCount() {
        return Integer.MAX_VALUE;
    }

    @Override
    public Object getItem(int i) {
        return labels.get(i % labels.size());
    }

    @Override
    public long getItemId(int i) {
        return i % labels.size();
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        ImageView imageView = new ImageView(context);
        imageView.setImageResource(labels.get(i % labels.size()));
        return imageView;
    }
}
